package top.littleze.aiattendance.utils.page;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @Author ZhaoGengze
 * @Date 2021/7/3 13:55
 */


public class PageResult<E> {
    public static final int DEFAULT_PAGE_SIZE = 10;
    private int index;
    private int pageSize;
    private long totalCount;
    private List<E> items;

    public PageResult(int index, int pageSize, long totalCount, List<E> items) {
        this.index = index;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.items = items;
    }

    public PageResult() {
        this.index = 0;
        this.pageSize = 10;
        this.totalCount = 0L;
        this.items = new ArrayList();
    }

    public boolean add(E e) {
        return this.items.add(e);
    }

    public boolean addAll(Collection<? extends E> c) {
        return this.items.addAll(c);
    }

    public int getIndex() {
        return this.index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotalCount() {
        return this.totalCount;
    }

    public void setTotalCount(long totalCount) {
        this.totalCount = totalCount;
    }

    public List<E> getItems() {
        return this.items;
    }

    public void setItems(List<E> items) {
        this.items = items;
    }
}

